/*
 *  idgenerator.cpp
 *  bgsubtraction
 *
 *  Created by a1gucis on 4/28/09.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */

#include "idgenerator.h"

IDGenerator::IDGenerator() {
	idR = 0;
	idG = 0;
	idB = 0;
}

ID *IDGenerator::getNewID() {
	idB++;
	if (idB > ID_UPPER_BOUND) {
		idB = 0;
		idG++;
	}
	if (idG > ID_UPPER_BOUND) {
		idG = 0;
		idR++;
	}
	
	ID *id = new ID(idR, idG, idB);
	return id;
}

void IDGenerator::reset() {
	idR = 0;
	idG = 0;
	idB = 0;
}